package com.ics.sapecit.utils.dom4j;


public class Dom4jUtils {
	/*public static Object xml2obj() {
		List<User> users = new ArrayList<User>();
		SAXReader reader = new SAXReader();
		try {
			Document document = reader.read(new File(ClassLoader
					.getSystemResource("test.xml").getPath()));
			Element rootElement = document.getRootElement();
			Iterator itar = rootElement.elementIterator();
			if ("user".equals(rootElement.getName())) {
				User user = new User();
				while (itar.hasNext()) {
					Element element = (Element) itar.next();
					if ("username".equals(element.getName())) {
						user.setUsername(element.getText());
					}
					if ("password".equals(element.getName())) {
						user.setPassword(element.getText());
					}
					if ("address".equals(element.getName())) {
						Iterator itarAddr = element.elementIterator();
						Address address = new Address();
						while (itarAddr.hasNext()) {
							Element elementAddr = (Element) itarAddr.next();
							if ("province".equals(elementAddr.getName())) {
								address.setProvince(elementAddr.getText());
							}
							if ("city".equals(elementAddr.getName())) {
								address.setCity(elementAddr.getText());
							}
						}
						user.setAddress(address);
					}
				}
				users.add(user);
			}

		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return users;
	}

	public static void main(String[] args) {
		System.out.println(xml2obj());
	}*/
}
